#ifndef __WS2812_CONTROL_H__
#define __WS2812_CONTROL_H__

#include "air001xx_hal.h"
#include "ws2812_dma.h"

// 彩虹效果切换速度
#define RAINBOW_SPEED 10

// 流水灯效果切换速度
#define RUNNING_SPEED 10

// 流星效果切换速度
#define METEOR_SPEED 10

// 随机所有效果切换速度
#define RANDOM_ALL_SPEED 5






typedef enum
{
    EFFECT_OFF,
    EFFECT_ON,
} PowerState_enum;
     
typedef enum
{
    EFFECT_SINGLE_COLOR,
    EFFECT_RAINBOW,
    EFFECT_BREATHING,
    EFFECT_RUNNING,
    EFFECT_METEOR,
    // EFFECT_RAINBOW_FLOW,
    // EFFECT_RANDOM_FLASH,
    EFFECT_COLOR_TRANSITION,
    EFFECT_SCAN,
    EFFECT_RANDOM_SINGLE,    // 单个LED随机点亮
    // EFFECT_RANDOM_BURST,     // 随机点亮多个LED
    // EFFECT_RANDOM_CHASE,     // 随机追逐效果
    EFFECT_RANDOM_ALL,       // 随机点亮所有LED
    EFFECT_COUNT,
    EFFECT_OFF_B
} EffectType;

extern WS2812_Controller ledStrip;

extern uint8_t uart_rx_buffer[16];
extern uint16_t uart_rx_len;
extern PowerState_enum powerState;
extern EffectType currentEffect;


void updateEffects_slow(void);
void updateEffects(void);
void rainbowEffect(void);
void breathingEffect(void);
void runningEffect(void);
void meteorEffect(void);
void rainbowFlowEffect(void);
void randomFlashEffect(void);
void colorTransitionEffect(void);
void scanEffect(void);
void processUartCommand(void);

void randomSingleEffect(void);
void randomBurstEffect(void);
void randomChaseEffect(void);
void randomAllEffect(void);

void setHue(uint8_t hue);
void setSaturation(uint8_t saturation);
void setBrightness(uint8_t brightness);
void setSpeed(uint8_t speed);
void setEffect(EffectType effect);
void powerOn(void);
void powerOff(void);


uint8_t get_power(void);
uint8_t get_effect(void);
uint8_t get_speed(void);
uint8_t get_brightness(void);
uint8_t get_hue(void);
uint8_t get_saturation(void);

#endif


